<?php
class ModelMessageLostProperty extends Model {
	
	private function filterSQL($data=array()){
		$sql = "";
		if(isset($data['keyword'])&!empty($data['keyword'])){
			$sql .=" and name like '%".$data['keyword']."%'";
		}
		return $sql;
	}
	
	public function getAllProperties($data=array()){
		$sql = "SELECT * FROM `" . DB_PREFIX . "config_lost_property`  where  status=0 ";
		$sql .=$this->filterSQL($data);
		
		$sort_data = array(
			'date_added'
		);	
			
		$query = $this->db->query($sql);
	
		return $query->rows;
	}
	
	
	public function getProperty($data = array()){
		$sql = "select clp.*,cc.title from ".DB_PREFIX."config_lost_property  clp left join ".DB_PREFIX."config_community cc on(cc.community_id=clp.community_id)  where lost_property_id='".(int)$data['lost_property_id']."'";
		return $this->db->query($sql)->row;
	}
	
	
}
?>